package com.slg.android.manyanime.bean;

import android.util.Log;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * Created by E540 on 2015/3/11.
 */
public class Animation {
    /**
     * 动画ID
     */
    private String id;
    /**
     * 动漫名称
     */
    private String name;
    /**
     * 图片地址
     */
    private String pic;
    /**
     * 更新至
     */
    private String lastUp;
    /**
     * 更新时间
     */
    private String updateTime;
    private String isNew;
    /**
     * 是否为广告  0不是 1是 若是广告则id为广告链接点击跳转webView 展示id中的网址
     */
    private String isAd;
    /**
     * 可以为空
     */
    private String tipsTime;
    /**
     * 可以为空
     */
    private String tipsContent;

    public Animation parseAnimation(JSONObject jsonObject) {
        try {
            this.name = jsonObject.getString("name");
            this.id = jsonObject.getString("id");
            this.pic = jsonObject.getString("pic");
            this.lastUp = jsonObject.getString("lastup");
            this.updateTime = jsonObject.getString("update_time");
            this.tipsTime = jsonObject.optString("tips_time");
            this.tipsContent = jsonObject.optString("tips_content");
            this.isAd = jsonObject.getString("is_ad");
            this.isNew = jsonObject.getString("is_new");
        } catch (JSONException e) {
            Log.e("解析出错", "错误信息", e);
        }
        return this;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public String getLastUp() {
        return lastUp;
    }

    public void setLastUp(String lastUp) {
        this.lastUp = lastUp;
    }

    public String getIsNew() {
        return isNew;
    }

    public void setIsNew(String isNew) {
        this.isNew = isNew;
    }

    public String getIsAd() {
        return isAd;
    }

    public void setIsAd(String isAd) {
        this.isAd = isAd;
    }

    public String getTipsTime() {
        return tipsTime;
    }

    public void setTipsTime(String tipsTime) {
        this.tipsTime = tipsTime;
    }

    public String getTipsContent() {
        return tipsContent;
    }

    public void setTipsContent(String tipsContent) {
        this.tipsContent = tipsContent;
    }

    public void parseJson(JSONObject object){
        try {
            id=object.getString("video_id");
            name=object.getString("name");
        } catch (JSONException e) {
            e.printStackTrace();
        }
        lastUp="更新至第九话";


    }




}
